/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package query.parser;

/**
 *
 * @author dzb
 */
public class Position {

	private ITokenizer tokenizer;
	private int row;
	private int col;

	public Position(ITokenizer tokenizer) {
		this.tokenizer = tokenizer;
	}

	public int getRow() {
		return row;
	}

	public void setRow(int r) {
		this.row = r;
	}

	public int getCol() {
		return col;
	}

	public void setCol(int c) {
		this.col = c;
	}

	public void newRow() {
		row++;
		col = 1;
	}

	@Override
	public String toString() {
		int cur_token_len = 0;
		if (tokenizer != null && tokenizer.getCurrent() != null) {
			cur_token_len = tokenizer.getCurrent().getValue().length();
		}
		return String.format("Row: %d, Col: %d", row, col-cur_token_len);
	}
}
